<?php
Globals::requireClass('Controller');
Globals::requireTable('Vision');

class IndexController extends Controller
{
	protected $VisionTable;
	
	public static $defaultConfig = array(
		'viewEnabled'	=> true,
		'layoutEnabled'	=> true,
		'title'			=> null
	);
	
	public function __construct($config = null)
	{
		parent::__construct($config);
		$this->VisionTable        = new VisionTable($config);
	}
	
	public function indexAction()
	{
		$this->layout->pageTitle	= "test";
	}
	
	public function visionAction(){
	    $vision = $this->VisionTable->getRow(array('status'=>1),'id DESC');
	    echo json_encode(array('returncode'=>0,'vision'=>$vision['vision']));
	    exit();
	}
	
	protected function out()
	{
		$this->layout->nav		= 'index';
		parent::out();
	}
}

Config::extend('IndexController', 'Controller');
